package com.zbowen.way.utils;

import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 简单封装一个 数据库连接 工具类
 */
public class DBUtils {

    public static final String user = "root";

    public static final String password = "123456";

    public static final String url = "jdbc:mysql://127.0.0.1:3306/xxl_job";

   private static Connection conn;

    public static Connection getConnection() {
        if (conn != null) {
            return conn;
        }
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            conn = DriverManager.getConnection(url, user, password);
            return conn;
        } catch (ClassNotFoundException | SQLException e) {
            throw new RuntimeException(e);
        }
    }

    public static void main(String[] args) throws SQLException, ParseException {
//        System.out.println(getConnection());

        System.out.println(new BigDecimal("20230531l"));

    }
}
